home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / GTFLPTRN.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  945 b   |  30 lines

  1. #include <stdio.h>
  2. #include <graphics.h>
  3. /* Define a fill pattern */
  4. char fillpat[8] =
  5.    {1, 3, 7, 0xf, 0x1f, 0x3f, 0x7f, 0xff},
  6.    oldpat[8];  /* Placeholder for old fill pattern */
  7. main()
  8. {
  9.    int graphdriver = DETECT, graphmode;
  10.    char buffer[80];
  11.  
  12. /* Initialize the graphics system */
  13.    initgraph(&graphdriver, &graphmode, "c:\\turboc");
  14.    outtextxy(10, 20, "Demonstrating getfillpattern");
  15.  
  16. /* Define a new pattern */
  17.    setfillpattern(fillpat, RED);
  18.    getfillpattern(oldpat);
  19.    sprintf(buffer, "Current fill pattern is: %x %x %x %x %x %x %x %x",
  20.    oldpat[0],oldpat[1],oldpat[2],oldpat[3],oldpat[4],oldpat[5],oldpat[6],
  21.    oldpat[7]);
  22.    outtextxy(10, 40, buffer);
  23.    outtextxy(10, 60, "Here is how it looks:");
  24. /* Draw a bar with current fill pattern */
  25.    bar(100, 100, 140, 200);
  26. /* Give user a chance to see the result */
  27.    outtextxy(10, 220, "Hit any key to exit:");
  28.    getch();
  29.    closegraph();
  30. }